import time

#1
file1 = open("m1_sorted.txt")
a = file1.readlines()
s = [int(i) for i in a]

tst = time.time()
for i in range(len(s)-1):
    for j in range(len(s)-2, i -1, -1):
        if s[j+1] < s[j]:
            s[j], s[j+1] = s[j+1], s[j]

tfi = time.time()

t = round((tfi - tst)*1000)
print("m1_sorted", t, "milliseconds")

#2
file2 = open("m2_reverse.txt")
a = file2.readlines()
s = [int(i) for i in a]



tst = time.time()
for i in range(len(s)-1):
    for j in range(len(s)-2, i -1, -1):
        if s[j+1] < s[j]:
            s[j], s[j+1] = s[j+1], s[j]

tfi = time.time()


t = round((tfi - tst)*1000)
print("m2_reverse", t, "milliseconds")


#3
file3 = open("m3_shuffle.txt")
a = file3.readlines()
s = [int(i) for i in a]

tst = time.time()
for i in range(len(s)-1):
    for j in range(len(s)-2, i -1, -1):
        if s[j+1] < s[j]:
            s[j], s[j+1] = s[j+1], s[j]

tfi = time.time()


t = round((tfi - tst)*1000)
print("m3_shuffle", t, "milliseconds")
